/**
 * C种颜色，染N格，要求连续K格颜色不能相同，求染色方案总数
 * 令Di是到i的方案总数，则
 * Di = (C - 1)(D[i-1] + D[i-2] + ... + D[i-K+1])
 * 后面一堆可以用类似前缀和来维护，记作level
 * 对每个i: 
 *     Di = (C - 1) * level
 *     level += Di - D[i - K + 1]
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>

using Real = long double;
using llt = long long;
using vi = vector<int>;

llt const MOD = 998244353LL;

int N, K, C;

llt proc(){
    vector<llt> D(N + 1, 0);
    D[0] = 1;
    if(1 == C){
        return N < K ? 1 : 0;
    }

    llt level = 0;
    for(int i=1;i<K;++i){
        D[i] = D[i - 1] * C % MOD;
        level = (level + D[i]) % MOD;
    }

    for(int i=K;i<=N;++i){
        // D[i] = (C * D[i - 1] % MOD - (C - 1LL) * D[i - K] % MOD) % MOD;
        D[i] = (C - 1LL) * level % MOD;
        level = (level + D[i] - D[i - K + 1]) % MOD;
        if(level < 0) level += MOD;
    }
    return D[N];
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int nofakse = 1;
    // cin >> nofakse;
    while(nofakse--){
        cin >> N >> C >> K;
        cout << proc() << endl;
    }
    return 0;
}